<template>
  <div>
    <van-field
    v-model="conent"
    :label="label"
    :type="type"
    :placeholder="placeholder"
    :rule="rule"
    />
  </div>
</template>

<script>
export default {
  props: ['label', 'type', 'placeholder', 'rule'],
  data () {
    return {
      conent: ''
    }
  },
  watch: {
    conent () {
      this.handlerulg()
    }
  },
  methods: {
    handlerulg () {
      const rue = new RegExp(this.rule)
      if (rue.test(this.conent)) {
        this.$emit('inputChange', this.conent)
      }
    }
  }
}
</script>

<style>

</style>
